package com.inei.model.dao;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.inei.model.connection.UtilDB;
import com.inei.model.entity.RespuestaCenso;

public class RespuestaCensoDao implements ICRUD<RespuestaCenso> {

	// variables
	private UtilDB util;
	private SQLiteDatabase db;
	private Cursor cursor = null;
	private Context context;
	private SimpleDateFormat dateFormat;

	public RespuestaCensoDao(Context context) {
		this.context = context;
		util = new UtilDB(context);
	}

	@Override
	public RespuestaCenso buscar(RespuestaCenso o) {
		RespuestaCenso obj = null;
		db = util.getReadableDatabase();
		cursor = db
				.rawQuery(
						"select * from RespuestaCenso where marco_id=? and formato_id=?",
						new String[] { o.getMarco_id() + "",
								o.getFormato_id() + "" });
		if (cursor.moveToFirst()) {
			obj = new RespuestaCenso();
			obj.setRespuesta_id(cursor.getInt(cursor
					.getColumnIndex("respuesta_id")));
			obj.setFormato_id(cursor.getInt(cursor.getColumnIndex("formato_id")));
			obj.setMarco_id(cursor.getInt(cursor.getColumnIndex("marco_id")));
			obj.setP4_1S(cursor.getString(cursor.getColumnIndex("P4_1S")));
			obj.setP4_1W(cursor.getString(cursor.getColumnIndex("P4_1W")));
			obj.setP4_2S(cursor.getString(cursor.getColumnIndex("P4_2S")));
			obj.setP4_2W(cursor.getString(cursor.getColumnIndex("P4_2W")));
			obj.setP5(cursor.getString(cursor.getColumnIndex("P5")));
			obj.setP6_DNI(cursor.getString(cursor.getColumnIndex("P6_DNI")));
			obj.setP6_AP(cursor.getString(cursor.getColumnIndex("P6_AP")));
			obj.setP6_AM(cursor.getString(cursor.getColumnIndex("P6_AM")));
			obj.setP6_N(cursor.getString(cursor.getColumnIndex("P6_N")));
			obj.setP7_DNI(cursor.getString(cursor.getColumnIndex("P7_DNI")));
			obj.setP7_AP(cursor.getString(cursor.getColumnIndex("P7_AP")));
			obj.setP7_AM(cursor.getString(cursor.getColumnIndex("P7_AM")));
			obj.setP7_N(cursor.getString(cursor.getColumnIndex("P7_N")));
			obj.setD1_F(cursor.getString(cursor.getColumnIndex("D1_F")));
			obj.setD1_IH(cursor.getString(cursor.getColumnIndex("D1_IH")));
			obj.setD1_IM(cursor.getString(cursor.getColumnIndex("D1_IM")));
			obj.setD1_FH(cursor.getString(cursor.getColumnIndex("D1_FH")));
			obj.setD1_FM(cursor.getString(cursor.getColumnIndex("D1_FM")));
			obj.setD1_TM(cursor.getInt(cursor.getColumnIndex("D1_TM")));
			obj.setD2_F(cursor.getString(cursor.getColumnIndex("D2_F")));
			obj.setD2_IH(cursor.getString(cursor.getColumnIndex("D2_IH")));
			obj.setD2_IM(cursor.getString(cursor.getColumnIndex("D2_IM")));
			obj.setD2_FH(cursor.getString(cursor.getColumnIndex("D2_FH")));
			obj.setD2_FM(cursor.getString(cursor.getColumnIndex("D2_FM")));
			obj.setD2_TM(cursor.getInt(cursor.getColumnIndex("D2_TM")));
			obj.setD3_F(cursor.getString(cursor.getColumnIndex("D3_F")));
			obj.setD3_IH(cursor.getString(cursor.getColumnIndex("D3_IH")));
			obj.setD3_IM(cursor.getString(cursor.getColumnIndex("D3_IM")));
			obj.setD3_FH(cursor.getString(cursor.getColumnIndex("D3_FH")));
			obj.setD3_FM(cursor.getString(cursor.getColumnIndex("D3_FM")));
			obj.setD3_TM(cursor.getInt(cursor.getColumnIndex("D3_TM")));
			obj.setD4_F(cursor.getString(cursor.getColumnIndex("D4_F")));
			obj.setD4_IH(cursor.getString(cursor.getColumnIndex("D4_IH")));
			obj.setD4_IM(cursor.getString(cursor.getColumnIndex("D4_IM")));
			obj.setD4_FH(cursor.getString(cursor.getColumnIndex("D4_FH")));
			obj.setD4_FM(cursor.getString(cursor.getColumnIndex("D4_FM")));
			obj.setD4_TM(cursor.getInt(cursor.getColumnIndex("D4_TM")));
			obj.setD4_TM(cursor.getInt(cursor.getColumnIndex("E_1")));
			obj.setE_2(cursor.getString(cursor.getColumnIndex("E_2")));
			obj.setC2_01(cursor.getInt(cursor.getColumnIndex("C2_01")));
			obj.setC2_02(cursor.getString(cursor.getColumnIndex("C2_02")));
			obj.setC2_11(cursor.getString(cursor.getColumnIndex("C2_11")));
			obj.setC2_12(cursor.getString(cursor.getColumnIndex("C2_12")));
			obj.setC2_13(cursor.getString(cursor.getColumnIndex("C2_13")));
			obj.setC2_21(cursor.getString(cursor.getColumnIndex("C2_21")));
			obj.setC2_22(cursor.getString(cursor.getColumnIndex("C2_22")));
			obj.setC2_23(cursor.getString(cursor.getColumnIndex("C2_23")));
			obj.setC2_31(cursor.getString(cursor.getColumnIndex("C2_31")));
			obj.setC2_32(cursor.getString(cursor.getColumnIndex("C2_32")));
			obj.setC2_33(cursor.getString(cursor.getColumnIndex("C2_33")));
			obj.setC2_41(cursor.getString(cursor.getColumnIndex("C2_41")));
			obj.setC2_42(cursor.getString(cursor.getColumnIndex("C2_42")));
			obj.setC2_43(cursor.getString(cursor.getColumnIndex("C2_43")));
			obj.setC2_51(cursor.getString(cursor.getColumnIndex("C2_51")));
			obj.setC2_52(cursor.getString(cursor.getColumnIndex("C2_52")));
			obj.setC2_53(cursor.getString(cursor.getColumnIndex("C2_53")));
			obj.setC2_61(cursor.getString(cursor.getColumnIndex("C2_61")));
			obj.setC2_62(cursor.getString(cursor.getColumnIndex("C2_62")));
			obj.setC2_63(cursor.getString(cursor.getColumnIndex("C2_63")));
			obj.setC2_71(cursor.getString(cursor.getColumnIndex("C2_71")));
			obj.setC2_72(cursor.getString(cursor.getColumnIndex("C2_72")));
			obj.setC2_73(cursor.getString(cursor.getColumnIndex("C2_73")));
			obj.setC2_80(cursor.getString(cursor.getColumnIndex("C2_80")));
			obj.setC2_81(cursor.getString(cursor.getColumnIndex("C2_81")));
			obj.setC2_82(cursor.getString(cursor.getColumnIndex("C2_82")));
			obj.setC2_83(cursor.getString(cursor.getColumnIndex("C2_83")));
			obj.setC2_90(cursor.getString(cursor.getColumnIndex("C2_90")));
			obj.setC2_91(cursor.getString(cursor.getColumnIndex("C2_91")));
			obj.setC2_92(cursor.getString(cursor.getColumnIndex("C2_92")));
			obj.setC2_93(cursor.getString(cursor.getColumnIndex("C2_93")));
			obj.setC3_1A(cursor.getString(cursor.getColumnIndex("C3_1A")));
			obj.setC3_1B(cursor.getString(cursor.getColumnIndex("C3_1B")));
			obj.setC3_2A(cursor.getString(cursor.getColumnIndex("C3_2A")));
			obj.setC3_2B(cursor.getString(cursor.getColumnIndex("C3_2B")));
			obj.setC3_3M(cursor.getInt(cursor.getColumnIndex("C3_3M")));
			obj.setC3_3IH(cursor.getString(cursor.getColumnIndex("C3_3IH")));
			obj.setC3_3IM(cursor.getString(cursor.getColumnIndex("C3_3IM")));
			obj.setC3_3FH(cursor.getString(cursor.getColumnIndex("C3_3FH")));
			obj.setC3_3FM(cursor.getString(cursor.getColumnIndex("C3_3FM")));
			obj.setC3_OB(cursor.getString(cursor.getColumnIndex("C3_OB")));
			obj.setC4_1A(cursor.getString(cursor.getColumnIndex("C4_1A")));
			obj.setC4_1B(cursor.getString(cursor.getColumnIndex("C4_1B")));
			obj.setC4_2A(cursor.getString(cursor.getColumnIndex("C4_2A")));
			obj.setC4_2B(cursor.getString(cursor.getColumnIndex("C4_2B")));
			obj.setC4_3M(cursor.getInt(cursor.getColumnIndex("C4_3M")));
			obj.setC4_3IH(cursor.getString(cursor.getColumnIndex("C4_3IH")));
			obj.setC4_3IM(cursor.getString(cursor.getColumnIndex("C4_3IM")));
			obj.setC4_3FH(cursor.getString(cursor.getColumnIndex("C4_3FH")));
			obj.setC4_3FM(cursor.getString(cursor.getColumnIndex("C4_3FM")));
			obj.setC4_OB(cursor.getString(cursor.getColumnIndex("C4_OB")));
			obj.setC5_1A(cursor.getString(cursor.getColumnIndex("C5_1A")));
			obj.setC5_1B(cursor.getString(cursor.getColumnIndex("C5_1B")));
			obj.setC5_2A(cursor.getString(cursor.getColumnIndex("C5_2A")));
			obj.setC5_2B(cursor.getString(cursor.getColumnIndex("C5_2B")));
			obj.setC5_3M(cursor.getInt(cursor.getColumnIndex("C5_3M")));
			obj.setC5_3IH(cursor.getString(cursor.getColumnIndex("C5_3IH")));
			obj.setC5_3IM(cursor.getString(cursor.getColumnIndex("C5_3IM")));
			obj.setC5_3FH(cursor.getString(cursor.getColumnIndex("C5_3FH")));
			obj.setC5_3FM(cursor.getString(cursor.getColumnIndex("C5_3FM")));
			obj.setC5_OB(cursor.getString(cursor.getColumnIndex("C5_OB")));
			obj.setC6_1A(cursor.getString(cursor.getColumnIndex("C6_1A")));
			obj.setC6_1B(cursor.getString(cursor.getColumnIndex("C6_1B")));
			obj.setC6_2A(cursor.getString(cursor.getColumnIndex("C6_2A")));
			obj.setC6_2B(cursor.getString(cursor.getColumnIndex("C6_2B")));
			obj.setC6_3M(cursor.getInt(cursor.getColumnIndex("C6_3M")));
			obj.setC6_3IH(cursor.getString(cursor.getColumnIndex("C6_3IH")));
			obj.setC6_3IM(cursor.getString(cursor.getColumnIndex("C6_3IM")));
			obj.setC6_3FH(cursor.getString(cursor.getColumnIndex("C6_3FH")));
			obj.setC6_3FM(cursor.getString(cursor.getColumnIndex("C6_3FM")));
			obj.setC6_OB(cursor.getString(cursor.getColumnIndex("C6_OB")));
			obj.setC7_1A(cursor.getString(cursor.getColumnIndex("C7_1A")));
			obj.setC7_1B(cursor.getString(cursor.getColumnIndex("C7_1B")));
			obj.setC7_2A(cursor.getString(cursor.getColumnIndex("C7_2A")));
			obj.setC7_2B(cursor.getString(cursor.getColumnIndex("C7_2B")));
			obj.setC7_3M(cursor.getInt(cursor.getColumnIndex("C7_3M")));
			obj.setC7_3IH(cursor.getString(cursor.getColumnIndex("C7_3IH")));
			obj.setC7_3IM(cursor.getString(cursor.getColumnIndex("C7_3IM")));
			obj.setC7_3FH(cursor.getString(cursor.getColumnIndex("C7_3FH")));
			obj.setC7_3FM(cursor.getString(cursor.getColumnIndex("C7_3FM")));
			obj.setC7_OB(cursor.getString(cursor.getColumnIndex("C7_OB")));
			obj.setC7_21A(cursor.getString(cursor.getColumnIndex("C7_21A")));
			obj.setC7_21B(cursor.getString(cursor.getColumnIndex("C7_21B")));
			obj.setC7_22A(cursor.getString(cursor.getColumnIndex("C7_22A")));
			obj.setC7_22B(cursor.getString(cursor.getColumnIndex("C7_22B")));
			obj.setC7_23M(cursor.getInt(cursor.getColumnIndex("C7_23M")));
			obj.setC7_23IH(cursor.getString(cursor.getColumnIndex("C7_23IH")));
			obj.setC7_23IM(cursor.getString(cursor.getColumnIndex("C7_23IM")));
			obj.setC7_23FH(cursor.getString(cursor.getColumnIndex("C7_23FH")));
			obj.setC7_23FM(cursor.getString(cursor.getColumnIndex("C7_23FM")));
			obj.setC7_2OB(cursor.getString(cursor.getColumnIndex("C7_2OB")));
			obj.setC7_31A(cursor.getString(cursor.getColumnIndex("C7_31A")));
			obj.setC7_31B(cursor.getString(cursor.getColumnIndex("C7_31B")));
			obj.setC7_32A(cursor.getString(cursor.getColumnIndex("C7_32A")));
			obj.setC7_32B(cursor.getString(cursor.getColumnIndex("C7_32B")));
			obj.setC7_33M(cursor.getInt(cursor.getColumnIndex("C7_33M")));
			obj.setC7_33IH(cursor.getString(cursor.getColumnIndex("C7_33IH")));
			obj.setC7_33IM(cursor.getString(cursor.getColumnIndex("C7_33IM")));
			obj.setC7_33FH(cursor.getString(cursor.getColumnIndex("C7_33FH")));
			obj.setC7_33FM(cursor.getString(cursor.getColumnIndex("C7_33FM")));
			obj.setC7_3OB(cursor.getString(cursor.getColumnIndex("C7_3OB")));
			obj.setC8_1A(cursor.getString(cursor.getColumnIndex("C8_1A")));
			obj.setC8_1B(cursor.getString(cursor.getColumnIndex("C8_1B")));
			obj.setC8_2A(cursor.getString(cursor.getColumnIndex("C8_2A")));
			obj.setC8_2B(cursor.getString(cursor.getColumnIndex("C8_2B")));
			obj.setC8_3M(cursor.getInt(cursor.getColumnIndex("C8_3M")));
			obj.setC8_3IH(cursor.getString(cursor.getColumnIndex("C8_3IH")));
			obj.setC8_3IM(cursor.getString(cursor.getColumnIndex("C8_3IM")));
			obj.setC8_3FH(cursor.getString(cursor.getColumnIndex("C8_3FH")));
			obj.setC8_3FM(cursor.getString(cursor.getColumnIndex("C8_3FM")));
			obj.setC8_OB(cursor.getString(cursor.getColumnIndex("C8_OB")));
			obj.setC9_1A(cursor.getString(cursor.getColumnIndex("C9_1A")));
			obj.setC9_1B(cursor.getString(cursor.getColumnIndex("C9_1B")));
			obj.setC9_2A(cursor.getString(cursor.getColumnIndex("C9_2A")));
			obj.setC9_2B(cursor.getString(cursor.getColumnIndex("C9_2B")));
			obj.setC9_3M(cursor.getInt(cursor.getColumnIndex("C9_3M")));
			obj.setC9_3IH(cursor.getString(cursor.getColumnIndex("C9_3IH")));
			obj.setC9_3IM(cursor.getString(cursor.getColumnIndex("C9_3IM")));
			obj.setC9_3FH(cursor.getString(cursor.getColumnIndex("C9_3FH")));
			obj.setC9_3FM(cursor.getString(cursor.getColumnIndex("C9_3FM")));
			obj.setC9_OB(cursor.getString(cursor.getColumnIndex("C9_OB")));
			obj.setC10_1A(cursor.getString(cursor.getColumnIndex("C10_1A")));
			obj.setC10_1B(cursor.getString(cursor.getColumnIndex("C10_1B")));
			obj.setC10_2A(cursor.getString(cursor.getColumnIndex("C10_2A")));
			obj.setC10_2B(cursor.getString(cursor.getColumnIndex("C10_2B")));
			obj.setC10_3M(cursor.getInt(cursor.getColumnIndex("C10_3M")));
			obj.setC10_3IH(cursor.getString(cursor.getColumnIndex("C10_3IH")));
			obj.setC10_3IM(cursor.getString(cursor.getColumnIndex("C10_3IM")));
			obj.setC10_3FH(cursor.getString(cursor.getColumnIndex("C10_3FH")));
			obj.setC10_3FM(cursor.getString(cursor.getColumnIndex("C10_3FM")));
			obj.setC10_OB(cursor.getString(cursor.getColumnIndex("C10_OB")));
			obj.setC11_1A(cursor.getString(cursor.getColumnIndex("C11_1A")));
			obj.setC11_1B(cursor.getString(cursor.getColumnIndex("C11_1B")));
			obj.setC11_2A(cursor.getString(cursor.getColumnIndex("C11_2A")));
			obj.setC11_2B(cursor.getString(cursor.getColumnIndex("C11_2B")));
			obj.setC11_3M(cursor.getInt(cursor.getColumnIndex("C11_3M")));
			obj.setC11_3IH(cursor.getString(cursor.getColumnIndex("C11_3IH")));
			obj.setC11_3IM(cursor.getString(cursor.getColumnIndex("C11_3IM")));
			obj.setC11_3FH(cursor.getString(cursor.getColumnIndex("C11_3FH")));
			obj.setC11_3FM(cursor.getString(cursor.getColumnIndex("C11_3FM")));
			obj.setC11_OB(cursor.getString(cursor.getColumnIndex("C11_OB")));
		}
		Cerrar();
		return obj;
	}

	@Override
	public List<RespuestaCenso> leer() {
		return null;
	}

	@Override
	public int crear(RespuestaCenso o) {
		int resultado = 0;
		db = util.getWritableDatabase();
		db.beginTransaction();
		ContentValues valores = new ContentValues();
		valores.put("formato_id", o.getFormato_id());
		valores.put("marco_id", o.getMarco_id());
		valores.put("P4_1S", o.getP4_1S());
		valores.put("P4_1W", o.getP4_1W());
		valores.put("P4_2S", o.getP4_2S());
		valores.put("P4_2W", o.getP4_2W());
		valores.put("P5", o.getP5());
		valores.put("P6_DNI", o.getP6_DNI());
		valores.put("P6_AP", o.getP6_AP());
		valores.put("P6_AM", o.getP6_AM());
		valores.put("P6_N", o.getP6_N());
		valores.put("P7_DNI", o.getP7_DNI());
		valores.put("P7_AP", o.getP7_AP());
		valores.put("P7_AM", o.getP7_AM());
		valores.put("P7_N", o.getP7_N());
		valores.put("D1_F", o.getD1_F());
		valores.put("D1_IH", o.getD1_IH());
		valores.put("D1_IM", o.getD1_IM());
		valores.put("D1_FH", o.getD1_FH());
		valores.put("D1_FM", o.getD1_FM());
		valores.put("D1_TM", o.getD1_TM());
		valores.put("D2_F", o.getD2_F());
		valores.put("D2_IH", o.getD2_IH());
		valores.put("D2_IM", o.getD2_IM());
		valores.put("D2_FH", o.getD2_FH());
		valores.put("D2_FM", o.getD2_FM());
		valores.put("D2_TM", o.getD2_TM());
		valores.put("D3_F", o.getD3_F());
		valores.put("D3_IH", o.getD3_IH());
		valores.put("D3_IM", o.getD3_IM());
		valores.put("D3_FH", o.getD3_FH());
		valores.put("D3_FM", o.getD3_FM());
		valores.put("D3_TM", o.getD3_TM());
		valores.put("D4_F", o.getD4_F());
		valores.put("D4_IH", o.getD4_IH());
		valores.put("D4_IM", o.getD4_IM());
		valores.put("D4_FH", o.getD4_FH());
		valores.put("D4_FM", o.getD4_FM());
		valores.put("D4_TM", o.getD4_TM());
		valores.put("E_1", o.getE_1());
		valores.put("E_2", o.getE_2());
		valores.put("C2_01", o.getC2_01());
		valores.put("C2_02", o.getC2_02());
		valores.put("C2_11", o.getC2_11());
		valores.put("C2_12", o.getC2_12());
		valores.put("C2_13", o.getC2_13());
		valores.put("C2_21", o.getC2_21());
		valores.put("C2_22", o.getC2_22());
		valores.put("C2_23", o.getC2_23());
		valores.put("C2_31", o.getC2_31());
		valores.put("C2_32", o.getC2_32());
		valores.put("C2_33", o.getC2_33());
		valores.put("C2_41", o.getC2_41());
		valores.put("C2_42", o.getC2_42());
		valores.put("C2_43", o.getC2_43());
		valores.put("C2_51", o.getC2_51());
		valores.put("C2_52", o.getC2_52());
		valores.put("C2_53", o.getC2_53());
		valores.put("C2_61", o.getC2_61());
		valores.put("C2_62", o.getC2_62());
		valores.put("C2_63", o.getC2_63());
		valores.put("C2_71", o.getC2_71());
		valores.put("C2_72", o.getC2_72());
		valores.put("C2_73", o.getC2_73());
		valores.put("C2_80", o.getC2_80());
		valores.put("C2_81", o.getC2_81());
		valores.put("C2_82", o.getC2_82());
		valores.put("C2_83", o.getC2_83());
		valores.put("C2_90", o.getC2_90());
		valores.put("C2_91", o.getC2_91());
		valores.put("C2_92", o.getC2_92());
		valores.put("C2_93", o.getC2_93());
		valores.put("C3_1A", o.getC3_1A());
		valores.put("C3_1B", o.getC3_1B());
		valores.put("C3_2A", o.getC3_2A());
		valores.put("C3_2B", o.getC3_2B());
		valores.put("C3_3M", o.getC3_3M());
		valores.put("C3_3IH", o.getC3_3IH());
		valores.put("C3_3IM", o.getC3_3IM());
		valores.put("C3_3FH", o.getC3_3FH());
		valores.put("C3_3FM", o.getC3_3FM());
		valores.put("C11_OB", o.getC11_OB());
		valores.put("C4_1A", o.getC4_1A());
		valores.put("C4_1B", o.getC4_1B());
		valores.put("C4_2A", o.getC4_2A());
		valores.put("C4_2B", o.getC4_2B());
		valores.put("C4_3M", o.getC4_3M());
		valores.put("C4_3IH", o.getC4_3IH());
		valores.put("C4_3IM", o.getC4_3IM());
		valores.put("C4_3FH", o.getC4_3FH());
		valores.put("C4_3FM", o.getC4_3FM());
		valores.put("C4_OB", o.getC4_OB());
		valores.put("C5_1A", o.getC5_1A());
		valores.put("C5_1B", o.getC5_1B());
		valores.put("C5_2A", o.getC5_2A());
		valores.put("C5_2B", o.getC5_2B());
		valores.put("C5_3M", o.getC5_3M());
		valores.put("C5_3IH", o.getC5_3IH());
		valores.put("C5_3IM", o.getC5_3IM());
		valores.put("C5_3FH", o.getC5_3FH());
		valores.put("C5_3FM", o.getC5_3FM());
		valores.put("C5_OB", o.getC5_OB());
		valores.put("C6_1A", o.getC6_1A());
		valores.put("C6_1B", o.getC6_1B());
		valores.put("C6_2A", o.getC6_2A());
		valores.put("C6_2B", o.getC6_2B());
		valores.put("C6_3M", o.getC6_3M());
		valores.put("C6_3IH", o.getC6_3IH());
		valores.put("C6_3IM", o.getC6_3IM());
		valores.put("C6_3FH", o.getC6_3FH());
		valores.put("C6_3FM", o.getC6_3FM());
		valores.put("C6_OB", o.getC6_OB());
		valores.put("C7_1A", o.getC7_1A());
		valores.put("C7_1B", o.getC7_1B());
		valores.put("C7_2A", o.getC7_2A());
		valores.put("C7_2B", o.getC7_2B());
		valores.put("C7_3M", o.getC7_3M());
		valores.put("C7_3IH", o.getC7_3IH());
		valores.put("C7_3IM", o.getC7_3IM());
		valores.put("C7_3FH", o.getC7_3FH());
		valores.put("C7_3FM", o.getC7_3FM());
		valores.put("C7_OB", o.getC7_OB());
		valores.put("C7_21A", o.getC7_21A());
		valores.put("C7_21B", o.getC7_21B());
		valores.put("C7_22A", o.getC7_22A());
		valores.put("C7_22B", o.getC7_22B());
		valores.put("C7_23M", o.getC7_23M());
		valores.put("C7_23IH", o.getC7_23IH());
		valores.put("C7_23IM", o.getC7_23IM());
		valores.put("C7_23FH", o.getC7_23FH());
		valores.put("C7_23FM", o.getC7_23FM());
		valores.put("C7_2OB", o.getC7_2OB());
		valores.put("C7_31A", o.getC7_31A());
		valores.put("C7_31B", o.getC7_31B());
		valores.put("C7_32A", o.getC7_32A());
		valores.put("C7_32B", o.getC7_32B());
		valores.put("C7_33M", o.getC7_33M());
		valores.put("C7_33IH", o.getC7_33IH());
		valores.put("C7_33IM", o.getC7_33IM());
		valores.put("C7_33FH", o.getC7_33FH());
		valores.put("C7_33FM", o.getC7_33FM());
		valores.put("C7_3OB", o.getC7_3OB());
		valores.put("C8_1A", o.getC8_1A());
		valores.put("C8_1B", o.getC8_1B());
		valores.put("C8_2A", o.getC8_2A());
		valores.put("C8_2B", o.getC8_2B());
		valores.put("C8_3M", o.getC8_3M());
		valores.put("C8_3IH", o.getC8_3IH());
		valores.put("C8_3IM", o.getC8_3IM());
		valores.put("C8_3FH", o.getC8_3FH());
		valores.put("C8_3FM", o.getC8_3FM());
		valores.put("C8_OB", o.getC8_OB());
		valores.put("C9_1A", o.getC9_1A());
		valores.put("C9_1B", o.getC9_1B());
		valores.put("C9_2A", o.getC9_2A());
		valores.put("C9_2B", o.getC9_2B());
		valores.put("C9_3M", o.getC9_3M());
		valores.put("C9_3IH", o.getC9_3IH());
		valores.put("C9_3IM", o.getC9_3IM());
		valores.put("C9_3IM", o.getC9_3IM());
		valores.put("C9_3FM", o.getC9_3FM());
		valores.put("C9_OB", o.getC9_OB());
		valores.put("C10_1A", o.getC10_1A());
		valores.put("C10_1B", o.getC10_1B());
		valores.put("C10_2A", o.getC10_2A());
		valores.put("C10_2B", o.getC10_2B());
		valores.put("C10_3M", o.getC10_3M());
		valores.put("C10_3IH", o.getC10_3IH());
		valores.put("C10_3IM", o.getC10_3IM());
		valores.put("C10_3FH", o.getC10_3FH());
		valores.put("C10_3FM", o.getC10_3FM());
		valores.put("C10_OB", o.getC10_OB());
		valores.put("C11_1A", o.getC11_1A());
		valores.put("C11_1B", o.getC11_1B());
		valores.put("C11_2A", o.getC11_2A());
		valores.put("C11_2B", o.getC11_2B());
		valores.put("C11_3M", o.getC11_3M());
		valores.put("C11_3IH", o.getC11_3IH());
		valores.put("C11_3IM", o.getC11_3IM());
		valores.put("C11_3FH", o.getC11_3FH());
		valores.put("C11_3FM", o.getC11_3FM());
		valores.put("C11_OB", o.getC11_OB());
		dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		valores.put("fecCrea", dateFormat.format(date));

		resultado = (int) db.insert("RespuestaCenso", null, valores);
		if (resultado > 0) {
			db.setTransactionSuccessful();
		}
		valores.clear();
		Cerrar();
		return resultado;
	}

	@Override
	public int eliminar(RespuestaCenso o) {
		return 0;
	}

	@Override
	public int actualizar(RespuestaCenso o) {
		int resultado = 0;
		db = util.getWritableDatabase();
		db.beginTransaction();
		ContentValues valores = new ContentValues();
		valores.put("P4_1S", o.getP4_1S());
		valores.put("P4_1W", o.getP4_1W());
		valores.put("P4_2S", o.getP4_2S());
		valores.put("P4_2W", o.getP4_2W());
		valores.put("P5", o.getP5());
		valores.put("P6_DNI", o.getP6_DNI());
		valores.put("P6_AP", o.getP6_AP());
		valores.put("P6_AM", o.getP6_AM());
		valores.put("P6_N", o.getP6_N());
		valores.put("P7_DNI", o.getP7_DNI());
		valores.put("P7_AP", o.getP7_AP());
		valores.put("P7_AM", o.getP7_AM());
		valores.put("P7_N", o.getP7_N());
		valores.put("D1_F", o.getD1_F());
		valores.put("D1_IH", o.getD1_IH());
		valores.put("D1_IM", o.getD1_IM());
		valores.put("D1_FH", o.getD1_FH());
		valores.put("D1_FM", o.getD1_FM());
		valores.put("D1_TM", o.getD1_TM());
		valores.put("D2_F", o.getD2_F());
		valores.put("D2_IH", o.getD2_IH());
		valores.put("D2_IM", o.getD2_IM());
		valores.put("D2_FH", o.getD2_FH());
		valores.put("D2_FM", o.getD2_FM());
		valores.put("D2_TM", o.getD2_TM());
		valores.put("D3_F", o.getD3_F());
		valores.put("D3_IH", o.getD3_IH());
		valores.put("D3_IM", o.getD3_IM());
		valores.put("D3_FH", o.getD3_FH());
		valores.put("D3_FM", o.getD3_FM());
		valores.put("D3_TM", o.getD3_TM());
		valores.put("D4_F", o.getD4_F());
		valores.put("D4_IH", o.getD4_IH());
		valores.put("D4_IM", o.getD4_IM());
		valores.put("D4_FH", o.getD4_FH());
		valores.put("D4_FM", o.getD4_FM());
		valores.put("D4_TM", o.getD4_TM());
		valores.put("E_1", o.getE_1());
		valores.put("E_2", o.getE_2());
		valores.put("C2_01", o.getC2_01());
		valores.put("C2_02", o.getC2_02());
		valores.put("C2_11", o.getC2_11());
		valores.put("C2_12", o.getC2_12());
		valores.put("C2_13", o.getC2_13());
		valores.put("C2_21", o.getC2_21());
		valores.put("C2_22", o.getC2_22());
		valores.put("C2_23", o.getC2_23());
		valores.put("C2_31", o.getC2_31());
		valores.put("C2_32", o.getC2_32());
		valores.put("C2_33", o.getC2_33());
		valores.put("C2_41", o.getC2_41());
		valores.put("C2_42", o.getC2_42());
		valores.put("C2_43", o.getC2_43());
		valores.put("C2_51", o.getC2_51());
		valores.put("C2_52", o.getC2_52());
		valores.put("C2_53", o.getC2_53());
		valores.put("C2_61", o.getC2_61());
		valores.put("C2_62", o.getC2_62());
		valores.put("C2_63", o.getC2_63());
		valores.put("C2_71", o.getC2_71());
		valores.put("C2_72", o.getC2_72());
		valores.put("C2_73", o.getC2_73());
		valores.put("C2_80", o.getC2_80());
		valores.put("C2_81", o.getC2_81());
		valores.put("C2_82", o.getC2_82());
		valores.put("C2_83", o.getC2_83());
		valores.put("C2_90", o.getC2_90());
		valores.put("C2_91", o.getC2_91());
		valores.put("C2_92", o.getC2_92());
		valores.put("C2_93", o.getC2_93());
		valores.put("C3_1A", o.getC3_1A());
		valores.put("C3_1B", o.getC3_1B());
		valores.put("C3_2A", o.getC3_2A());
		valores.put("C3_2B", o.getC3_2B());
		valores.put("C3_3M", o.getC3_3M());
		valores.put("C3_3IH", o.getC3_3IH());
		valores.put("C3_3IM", o.getC3_3IM());
		valores.put("C3_3FH", o.getC3_3FH());
		valores.put("C3_3FM", o.getC3_3FM());
		valores.put("C3_OB", o.getC3_OB());
		valores.put("C4_1A", o.getC4_1A());
		valores.put("C4_1B", o.getC4_1B());
		valores.put("C4_2A", o.getC4_2A());
		valores.put("C4_2B", o.getC4_2B());
		valores.put("C4_3M", o.getC4_3M());
		valores.put("C4_3IH", o.getC4_3IH());
		valores.put("C4_3IM", o.getC4_3IM());
		valores.put("C4_3FH", o.getC4_3FH());
		valores.put("C4_3FM", o.getC4_3FM());
		valores.put("C4_OB", o.getC4_OB());
		valores.put("C5_1A", o.getC5_1A());
		valores.put("C5_1B", o.getC5_1B());
		valores.put("C5_2A", o.getC5_2A());
		valores.put("C5_2B", o.getC5_2B());
		valores.put("C5_3M", o.getC5_3M());
		valores.put("C5_3IH", o.getC5_3IH());
		valores.put("C5_3IM", o.getC5_3IM());
		valores.put("C5_3FH", o.getC5_3FH());
		valores.put("C5_3FM", o.getC5_3FM());
		valores.put("C5_OB", o.getC5_OB());
		valores.put("C6_1A", o.getC6_1A());
		valores.put("C6_1B", o.getC6_1B());
		valores.put("C6_2A", o.getC6_2A());
		valores.put("C6_2B", o.getC6_2B());
		valores.put("C6_3M", o.getC6_3M());
		valores.put("C6_3IH", o.getC6_3IH());
		valores.put("C6_3IM", o.getC6_3IM());
		valores.put("C6_3FH", o.getC6_3FH());
		valores.put("C6_3FM", o.getC6_3FM());
		valores.put("C6_OB", o.getC6_OB());
		valores.put("C7_1A", o.getC7_1A());
		valores.put("C7_1B", o.getC7_1B());
		valores.put("C7_2A", o.getC7_2A());
		valores.put("C7_2B", o.getC7_2B());
		valores.put("C7_3M", o.getC7_3M());
		valores.put("C7_3IH", o.getC7_3IH());
		valores.put("C7_3IM", o.getC7_3IM());
		valores.put("C7_3FH", o.getC7_3FH());
		valores.put("C7_3FM", o.getC7_3FM());
		valores.put("C7_OB", o.getC7_OB());
		valores.put("C7_21A", o.getC7_21A());
		valores.put("C7_21B", o.getC7_21B());
		valores.put("C7_22A", o.getC7_22A());
		valores.put("C7_22B", o.getC7_22B());
		valores.put("C7_23M", o.getC7_23M());
		valores.put("C7_23IH", o.getC7_23IH());
		valores.put("C7_23IM", o.getC7_23IM());
		valores.put("C7_23FH", o.getC7_23FH());
		valores.put("C7_23FM", o.getC7_23FM());
		valores.put("C7_2OB", o.getC7_2OB());
		valores.put("C7_31A", o.getC7_31A());
		valores.put("C7_31B", o.getC7_31B());
		valores.put("C7_32A", o.getC7_32A());
		valores.put("C7_32B", o.getC7_32B());
		valores.put("C7_33M", o.getC7_33M());
		valores.put("C7_33IH", o.getC7_33IH());
		valores.put("C7_33IM", o.getC7_33IM());
		valores.put("C7_33FH", o.getC7_33FH());
		valores.put("C7_33FM", o.getC7_33FM());
		valores.put("C7_3OB", o.getC7_3OB());
		valores.put("C8_1A", o.getC8_1A());
		valores.put("C8_1B", o.getC8_1B());
		valores.put("C8_2A", o.getC8_2A());
		valores.put("C8_2B", o.getC8_2B());
		valores.put("C8_3M", o.getC8_3M());
		valores.put("C8_3IH", o.getC8_3IH());
		valores.put("C8_3IM", o.getC8_3IM());
		valores.put("C8_3FH", o.getC8_3FH());
		valores.put("C8_3FM", o.getC8_3FM());
		valores.put("C8_OB", o.getC8_OB());
		valores.put("C9_1A", o.getC9_1A());
		valores.put("C9_1B", o.getC9_1B());
		valores.put("C9_2A", o.getC9_2A());
		valores.put("C9_2B", o.getC9_2B());
		valores.put("C9_3M", o.getC9_3M());
		valores.put("C9_3IH", o.getC9_3IH());
		valores.put("C9_3IM", o.getC9_3IM());
		valores.put("C9_3IM", o.getC9_3IM());
		valores.put("C9_3FM", o.getC9_3FM());
		valores.put("C9_OB", o.getC9_OB());
		valores.put("C10_1A", o.getC10_1A());
		valores.put("C10_1B", o.getC10_1B());
		valores.put("C10_2A", o.getC10_2A());
		valores.put("C10_2B", o.getC10_2B());
		valores.put("C10_3M", o.getC10_3M());
		valores.put("C10_3IH", o.getC10_3IH());
		valores.put("C10_3IM", o.getC10_3IM());
		valores.put("C10_3FH", o.getC10_3FH());
		valores.put("C10_3FM", o.getC10_3FM());
		valores.put("C10_OB", o.getC10_OB());
		valores.put("C11_1A", o.getC11_1A());
		valores.put("C11_1B", o.getC11_1B());
		valores.put("C11_2A", o.getC11_2A());
		valores.put("C11_2B", o.getC11_2B());
		valores.put("C11_3M", o.getC11_3M());
		valores.put("C11_3IH", o.getC11_3IH());
		valores.put("C11_3IM", o.getC11_3IM());
		valores.put("C11_3FH", o.getC11_3FH());
		valores.put("C11_3FM", o.getC11_3FM());
		valores.put("C11_OB", o.getC11_OB());
		dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		valores.put("fec_modi", dateFormat.format(date));

		resultado = (int) db.update("RespuestaCenso", valores,
				"respuesta_id=? and formato_id=? and marco_id=?",
				new String[] { o.getRespuesta_id() + "",
						o.getFormato_id() + "", o.getMarco_id() + "" });
		if (resultado > 0) {
			db.setTransactionSuccessful();
		}
		valores.clear();
		Cerrar();
		return resultado;
	}

	private void Cerrar() {
		if (cursor != null) {
			cursor.close();
		}
		if (db.inTransaction()) {
			db.endTransaction();
		}
		db.close();
	}
}
